<!DOCTYPE HTML>
<html lang="zh-CN" manifest="./h5.manifest">
<head>
    <meta charset="utf-8"/>
    <title>大学加调查问卷</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <link href="./bootstrap.min.css" rel="stylesheet">
    <script src="./jquery-1.11.2.min.js"></script>
    <script src="./bootstrap.min.js"></script>
    <script>
        if ( typeof (Storage) === "undefined") {
            alert("该浏览器不支持本地数据存储");
        }
        //保存数据
        function save() {
            var username = document.getElementById("iptusername").value;
            var mobile = document.getElementById("iptmobile").value;
            var sex = $('input:radio[name=sex]:checked').val();
            var zhuangye = document.getElementById("iptzhuangye").value;
            var qita = document.getElementById("qita").value;
            var q1 = $('input:radio[name=q1]:checked').val();
            var q2 = $('input:radio[name=q2]:checked').val();
            if(username==''){
                alert('请填写您的姓名');
                return false;
            }
            if(mobile==''){
                alert('请填写您的联系电话');
                return false;
            }
            if(zhuangye==''){
                alert('请填写您的专业');
                return false;
            }
            if(!(q1)){
                alert('报名表还没有填写完整');
                return false;
            }
            if(!(q2)){
                alert('报名表还没有填写完整');
                return false;
            }
            //创建时间
            var time = new Date().getTime();
            var val = {
                'username' : username,
                'mobile' : mobile,
                'sex' : sex,
                'zhuangye' : zhuangye,
                'q1' : q1,
                'q2' : q2,
                'qita' : qita,
                'time' : time,
                'isstatus' : 0
            };
            localStorage.setItem(time,JSON.stringify(val));
            val=localStorage.getItem(time);
            if(val){
                onSuccess();
            }
        }

        //sql语句执行成功后执行的回调函数
        function onSuccess() {
            alert("操作成功");
            document.myform.reset();
        }

        Date.prototype.format = function(format) {
            var o = {
                "M+" : this.getMonth() + 1, //month
                "d+" : this.getDate(), //day
                "h+" : this.getHours(), //hour
                "m+" : this.getMinutes(), //minute
                "s+" : this.getSeconds(), //second
                "q+" : Math.floor((this.getMonth() + 3) / 3), //quarter
                "S" : this.getMilliseconds() //millisecond
            }
            if (/(y+)/.test(format))
                format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
            for (var k in o)
                if (new RegExp("(" + k + ")").test(format))
                    format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
            return format;
        }
    </script>
    <style>
        .form-group label{height:auto; line-height: 150%; font-size: 18px; margin-top:10px; margin-bottom: 10px;}
        .radio-inline{
            display:block; height:auto; line-height: 150%; font-size: 18px; padding-left:20px;margin-left:0;
        }
        .radio-inline+.radio-inline{
            margin-left:0; margin-top:10px; margin-bottom: 10px;
        }
    </style>
</head>
<body>
<nav class="main-nav navbar navbar-inverse navbar-static-top clearfix">
    <!-- navbar-fixed-top -->
    <div class="container-fluid">
        <a class="navbar-brand" href="http://www.iic.cn/">『大学加』专业的人才服务机构</a>
    </div>
</nav>
<div id="main-container" class="container-fluid">
    <div class="row">
        <div class="col-xs-12 col-sm-12 col-md-12">
            <h1>『大学加』报名表</h1>
            <p>
                身居互联网的风口,<br>紧跟大学加的脚步,<br>一起迎接未来时代.<br><br>
                改变命运，<br>就在这里，<br>你准备好了吗？
            </p>
            <form onsubmit="void();" name="myform">
                <div class="form-group">
                    <label for="iptusername">姓名：</label>
                    <input type="text" name="username" class="form-control" id="iptusername" placeholder="请输入您的姓名">
                </div>
                <div class="form-group">
                    <label for="iptmobile">电话：</label>
                    <input type="text" class="form-control" name="mobile" id="iptmobile" placeholder="请输入您的联系电话">
                </div>
                <div class="form-group">
                    <label for="iptzhuangye">所学专业：</label>
                    <input type="text" name="zhuangye" class="form-control" id="iptzhuangye" placeholder="请输入您的所学专业">
                </div>
                <div class="form-group">
                    <label for="iptsex">性别：</label>
                    <label class="radio-inline">
                        <input type="radio" name="sex" value="男生">
                        男生</label>
                    <label class="radio-inline">
                        <input type="radio" name="sex" value="女生">
                        女生</label>
                </div>

                <div class="form-group">
                    <label for="q1">Q1、您的年级：</label>
                    <label class="radio-inline">
                        <input type="radio" name="q1" value="大一">
                        大一</label>
                    <label class="radio-inline">
                        <input type="radio" name="q1" value="大二">
                        大二</label>
                    <label class="radio-inline">
                        <input type="radio" name="q1" value="大三">
                        大三</label>
                    <label class="radio-inline">
                        <input type="radio" name="q1" value="大四">
                        大四</label>
                </div>
                <div class="form-group">
                    <label for="q1">Q2、您感兴趣的班级：</label>
                    <label class="radio-inline">
                        <input type="radio" name="q2" value="A">
                        互联网兴趣班</label>
                    <label class="radio-inline">
                        <input type="radio" name="q2" value="B">
                        互联网高薪职业班</label>
                    <label class="radio-inline">
                        <input type="radio" name="q2" value="C">
                        周六日公开课</label>
                    <label class="radio-inline">
                        <input type="radio" name="q2" value="D">
                        沙龙/座谈</label>
                </div>
                <div class="form-group">
                    <label for="qita">备注信息：</label>
                    <input type="text" name="qita" class="form-control" id="qita" placeholder="输入需要备注的信息" value="无">
                </div>

                <button type="button" class="btn btn-primary" onclick="save()" style="width: 100%">
                    感谢您的参与，谢谢提交！
                </button>
            </form>
        </div>
    </div>
</div>
<div style="height: 100px;"></div>
</body>
</html>